<?php if(!defined('BASEPATH'))exit('No direct script access allowed'); ?>
<?php $this->load->view('admin/global/header'); ?>
<?php $this->load->view('admin/global/left'); ?>
<table cellpadding="0" cellspacing="0">
    <tr>
        <td class="title"><?php echo lang('LIST').': '.lang('CART'); ?></td>
    </tr>
    <?php if(isset($denied)){ ?>
    <tr>
        <td class="bar">
            <div class="error"><?php echo lang('DENIED'); ?></div>
            <meta http-equiv="refresh" content="5; <?php echo base_url().ADMIN_PATH; ?>" />
        </td>
    </tr>
    <?php }else{ ?>
    <?php echo Modules::run('admin/bar_module/index', $buttons, $searchs, $filters); ?>
    <tr>
        <td valign="top">
        <form name="frmView" id="frmView" method="post">
            <table class="view" cellpadding="0" cellspacing="0">
                <tr class="title">
                    <td class="index">#</td>
                    <td width="20">
                        <input type="checkbox" name="checkAll" id="checkAll" value="0" />
                    </td>
                    <?php echo Modules::run('admin/sort_module/index', 'buyer', lang('BUYER')); ?>
                    <td><?php echo lang('SALER'); ?></td>
                    <td><?php echo lang('PRODUCT'); ?></td>
                    <?php echo Modules::run('admin/sort_module/index', 'process', lang('PROCESS'), 80); ?>
                    <?php echo Modules::run('admin/sort_module/index', 'buyDate', lang('BUY_DATE'), 110); ?>
                    <?php echo Modules::run('admin/sort_module/index', 'id', lang('ID'), 50); ?>
                </tr>
                <!--LOOP-->
                <?php $index = 1; ?>
                <?php foreach($rows as $row){ ?>
                <tr class="<?php if($index%2 == 0){echo 'bgColor';} ?>">
                    <td class="index"><?php echo $sTT++; ?></td>
                    <td align="center">
                        <input type="checkbox" name="idRecord[]" id="idRecord<?php echo $index; ?>" class="idRecord" value="<?php echo $row->carID; ?>" />
                    </td>
                    <td>
                        <?php echo $row->useUsername; ?>
                        <img src="<?php echo base_url(); ?>templates/admin/images/expand.png" class="vtip" title="<?php echo tip(array(lang('FULLNAME')=>$row->useFullname, lang('ADDRESS')=>$row->useAddress, lang('EMAIL')=>$row->useEmail, lang('TEL')=>$row->usePhone)); ?>" align="absmiddle" />
                    </td>
                    <td>
                        <?php if(isset($salers)){ ?>
                        <?php foreach($salers as $saler){ ?>
                        <?php if((int)$row->carID == (int)$saler->carID){ ?>
                        <?php echo $saler->useUsername; ?>
                        <img src="<?php echo base_url(); ?>templates/admin/images/expand.png" class="vtip" title="<?php echo tip(array(lang('FULLNAME')=>$saler->useFullname, lang('ADDRESS')=>$saler->useAddress, lang('EMAIL')=>$saler->useEmail, lang('TEL')=>$saler->usePhone)); ?>" align="absmiddle" />
                        <?php break; ?>
                        <?php } ?>
                        <?php } ?>
                        <?php } ?>
                    </td>
                    <td style="line-height:16px;">
                        <?php if(isset($products)){ ?>
                        <?php $i = 1; ?>
                        <?php foreach($products as $product){ ?>
                        <?php if((int)$row->carID == (int)$product->capCart){ ?>
                        <div>
                            <?php echo $i++.'. '; ?>
                            <a href="<?php echo base_url(); ?>product/section/<?php echo $product->proSection; ?>/category/<?php echo $product->proCategory; ?>/detail/<?php echo $product->proID; ?>/<?php echo url($product->proName); ?>" title="<?php echo lang('VIEW'); ?>" target="_blank"><?php echo sub($product->proName, 50); ?></a>
                            (<span class="red"><?php echo currency($product->proPrice).' '.$product->proCurrency; ?></span> <i>x <?php echo $product->capQuantity; ?> =</i> <span class="red"><?php echo currency(round(($product->proPrice)*($product->capQuantity))).' '.$product->proCurrency; ?></span>)
                        </div>
                        <?php } ?>
                        <?php } ?>
                        <?php } ?>
                    </td>
                    <td align="center">
                        <?php if((int)$row->carProcess == 1){ ?>
                        <img src="<?php echo base_url(); ?>templates/admin/images/status1.png" onclick="eProc('UNPROCESS', 'idRecord<?php echo $index; ?>')" title="<?php echo lang('UNPROCESS'); ?>" />
                        <?php }else{ ?>
                        <img src="<?php echo base_url(); ?>templates/admin/images/status0.png" onclick="eProc('PROCESS', 'idRecord<?php echo $index; ?>')" title="<?php echo lang('PROCESS'); ?>" />
                        <?php } ?>
                    </td>
                    <td align="center"><b><?php echo date_convert($row->carBuyDate); ?></b></td>
                    <td align="center"><?php echo $row->carID; ?></td>
                </tr>
                <?php $index++; ?>
                <?php } ?>
                <!--LOOP-->
                <?php echo Modules::run('admin/pagination_module/index', $total, 8); ?>
            </table>
            <input type="hidden" name="action" value="" />
            <input type="hidden" name="value" value="" />
        </form>
        </td>
    </tr>
    <?php } ?>
</table>
<?php $this->load->view('admin/global/right'); ?>
<?php $this->load->view('admin/global/footer'); ?>